
***************************************************

cd "G:\My Drive\Jerry_Felipe_Boards\analysis\data_analysis"

* Connection to the OD network
use overlapping_directors_double, clear
keep gvkey1 gvkey2 year
collapse gvkey2, by(gvkey1 year)
replace gvkey2=1
rename gvkey2 odn_connection
rename gvkey1 gvkey
save odn_connection, replace

* Connection to the TN4 OD network
use overlapping_directors_double, clear
keep gvkey1 gvkey2 year
joinby gvkey1 gvkey2 year using tnic4_data, unmatched(master)
keep if  _merge==3
drop _merge score
collapse gvkey2, by(gvkey1 year)
replace gvkey2=1
rename gvkey2 codn_connection
rename gvkey1 gvkey
save codn_connection, replace

* connection to other association network
use overlapping_directors_other_double, clear
keep gvkey1 gvkey2 year
collapse gvkey2, by(gvkey1 year)
replace gvkey2=1
rename gvkey2 other_connection
rename gvkey1 gvkey
save other_connection, replace

* connection to TN4 network through other associations
use overlapping_directors_other_double, clear
keep gvkey1 gvkey2 year
joinby gvkey1 gvkey2 year using tnic4_data, unmatched(master)
keep if  _merge==3
drop _merge score
collapse gvkey2, by(gvkey1 year)
replace gvkey2=1
rename gvkey2 othertn4_connection
rename gvkey1 gvkey
save othertn4_connection, replace
